package 剑指Offer.easy;

public class 二进制中1的位数 {
    public class Solution {
        // you need to treat n as an unsigned value
        public int hammingWeight(int n) {
            int res = 0;
            while (n != 0) {
                res += n & 1;
                n >>>= 1;
            }
            return res;
        }
    }
}
